#ifndef CONFIG_H
#define CONFIG_H

#include "singleton.h"

#define DECLEAR_ENTRY_TYPE(entry)\
    struct entry##Entry;\
    typedef std::map<int, entry##Entry> entry##EntryMap;

#define DECLEAR_GET_METHOD(cfg)\
    const cfg##Entry *Get##cfg##Entry( int type );\
    const cfg##EntryMap &Get##cfg##EntryMap( );

DECLEAR_ENTRY_TYPE(Army);
DECLEAR_ENTRY_TYPE(City);
DECLEAR_ENTRY_TYPE(General);

class Config:public CSingleton<Config>
{
    IMPLEMENT_SINGLETON(Config);
public:
    DECLEAR_GET_METHOD(Army);
    DECLEAR_GET_METHOD(City);
    DECLEAR_GET_METHOD(General);
    void ReadConfigs( );
    void ReadArmyConfig( );
    void ReadCityConfig( );
    void ReadGeneralConfig( );
protected:
    ArmyEntryMap m_mapArmy;
    CityEntryMap m_mapCity;
    GeneralEntryMap m_mapGeneral;
};

#endif